<!--upload.html 当初用的目的是为了调试kindeditor的远程上传功能。
    没有其他作用，可以删除
-->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.thymeleaf.org"
      >
<head>
    <title>商品管理</title>
    <link rel="stylesheet" type="text/css" th:href="@{/H-UI/lib/kindeditor-4.1.10/themes/default/default.css}" />


</head>
<body>
<section class="Hui-article-box" layout:fragment="content">
    <div class="upload">
        <input class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> <input type="button" id="uploadButton" value="Upload" />
    </div>
    </section>
<script type="text/javascript" th:src="@{/H-UI/lib/kindeditor-4.1.10/kindeditor-all.js}"></script>
<script type="text/javascript" th:src="@{/H-UI/lib/kindeditor-4.1.10/lang/zh_CN.js}"></script>
<script type="text/javascript" th:src="@{/scripts/goods/add.js}"></script>
<script>
    KindEditor.ready(function(K) {
        var uploadbutton = K.uploadbutton({
            button : K('#uploadButton')[0],
            fieldName : 'imgFile',
            url : 'http://localhost:8080/qiniu/upload/image',
            afterUpload : function(data) {
                if (data.error === 0) {
                    var url = K.formatUrl(data.url, 'absolute');
                    K('#url').val(url);
                } else {
                    alert(data.message);
                }
            },
            afterError : function(str) {
                alert('自定义错误信息: ' + str);
            }
        });
        uploadbutton.fileBox.change(function(e) {
            uploadbutton.submit();
        });
    });
</script>
</body>
</html>